Skip to content

record: Pin Decimal storage behavior - #1427

Open
bstaeheli wants to merge 4 commits into
aldevtools:masterfrom
bstaeheli:al-runtime-rs-staging-pub-decimal-store-7866
Open

bstaeheli wants to merge 4 commits into
aldevtools:masterfrom
bstaeheli:al-runtime-rs-staging-pub-decimal-store-7866

Conversation

@bstaeheli

@bstaeheli bstaeheli commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

What this PR adds or changes

Pin Decimal storage, buffer preservation, filters, key lookups, unique-key collisions, and temporary record behavior observed on Business Central.

Validation:

  • Original assertions passed locally on BC 27.5, 28.5, and 29.1 in an isolated app.
  • Expanded filter-boundary, key-lookup, and non-colliding write assertions passed locally on BC 27.5 and 28.5; the isolated app compiled with AL 16.4 and 17.0.
  • python .github\scripts\check-object-ids.py .: passed.
  • python .github\scripts\check-singleinstance-fixture-owners.py: passed.
  • python .github\scripts\check-install-triggers.py .: passed.
  • python .github\scripts\test-install-triggers.py: passed.
  • python .github\scripts\test-singleinstance-fixture-owners.py: passed.
  • On this head, .github/scripts self-tests, Object IDs must be unique and in range, and Coverage facts must not shrink passed.
  • The BC 27.5, 28.5, and 29.0 PR CI jobs are queued.

Linked issue

n/a

Related: aldevtools/BusinessCentral.AL.Runner#7866

Test area(s)

record/crud/

Checklist

  • Initialize() is the first line of every [Test] procedure
  • Initialize() calls DeleteAll() on every table used in the codeunit
  • Shared _fixtures/ objects used; each local object has a // local object: <reason> line
  • New files are in <area>/<topic>/ (no writer id, issue number or batch name in a folder name)
  • New tests are at the end of the topic's existing codeunit; no codeunit renumbered, no test or must-not-compile case renamed
  • A removed or merged test has a line in tests/rename-map.tsv (not applicable; none removed or merged)
  • Test name uniquely identifies the claim without reading the body (Type_Method_Scenario_Outcome)
  • Doc-link comment block is present at the top of each new file
  • Out-of-scope tests are in the area of the feature and confirm the error only (not applicable)
  • Version-gated code uses #if BC28PLUS (or equivalent) with an explanatory comment (not applicable)
  • CI passes on this pull request (all required checks: BC 27.5, 28.5 and 29.0)

The new procedures call Initialize() first and clear the tables they use; existing procedures retain their existing seed setup.

bstaeheli and others added 2 commits November 16, 2026 16:40
Add measured probes for persisted precision, key/filter lookups, unique collisions, and temporary records across BC 27.5, 28.5, and 29.1.

Session: act-on-feedback-issue-7866
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Session: act-on-feedback-issue-7866
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@StefanMaron

Copy link
Copy Markdown
Collaborator

This is still a draft, and two checklist items are open: Initialize() as the first line of every new [Test] procedure, and test names in the Type_Method_Scenario_Outcome form. When those are done, please mark it ready for review. Its CI run waits for my approval, and I review it then. runner#7866 depends on it.

Use the corpus test naming convention without changing the measured behavior.

Session: act-on-feedback-issue-7866

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bstaeheli
bstaeheli marked this pull request as ready for review November 17, 2026 16:11
Copilot AI balanced review requested due to automatic review settings November 17, 2026 16:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The Decimal-key tests can pass despite broken filtering, lookups that do not load records, or blanket rejection of high-scale writes, leaving significant behavior insufficiently verified.

3 open issues
What changed in this PR

This PR extends the AL language test suite to pin Business Central’s Decimal storage behavior, including precision truncation and its effects on record operations.

Changes:

  • Adds tests for stored precision, buffer preservation, filters, key lookups, and temporary records.
  • Adds Insert, Modify, and Rename collision tests using a unique Decimal secondary key.
  • Updates test headers with the reported BC validation versions.
File Description
tests/​al-language/​record/​crud/​RcAGetFind.al Adds Decimal storage and record-operation assertions with setup and observation helpers.
tests/​al-language/​record/​crud/​DecimalStorageUnique.Table.al Adds a local table with a unique Decimal secondary key for collision tests.

Review effort: Balanced

Comment on lines +813 to +836
Row.SetRange(Amt, Full);
Observer.Observe('equal_full', Format(Row.Count()));
Row.SetRange(Amt, Cut);
Observer.Observe('equal_cut', Format(Row.Count()));
Row.SetFilter(Amt, '<%1', Full);
Observer.Observe('less_full', Format(Row.Count()));
Row.SetFilter(Amt, '<%1', Cut);
Observer.Observe('less_cut', Format(Row.Count()));
Row.SetFilter(Amt, '>%1', Full);
Observer.Observe('greater_full', Format(Row.Count()));
Row.SetFilter(Amt, '>%1', Cut);
Observer.Observe('greater_cut', Format(Row.Count()));
Row.SetRange(Amt, Full, Full);
Observer.Observe('range_full', Format(Row.Count()));
Row.SetRange(Amt, Cut, Cut);
Observer.Observe('range_cut', Format(Row.Count()));
Row.SetRange(Amt, Cut, Full);
Observer.Observe('range_cut_full', Format(Row.Count()));
Observer.Expect('equal_full', '1');
Observer.Expect('equal_cut', '1');
Observer.Expect('less_full', '0');
Observer.Expect('less_cut', '0');
Observer.Expect('greater_full', '0');
Observer.Expect('greater_cut', '0');
Comment on lines +854 to +866
Row.Dc := Full;
Row.Insert();
Observer.Observe('buffer_equal', Format(Row.Dc = Full));
Observer.Observe('get_full', Format(Found.Get(Full)));
Observer.Observe('get_cut', Format(Found.Get(Cut)));
if Found.FindFirst() then
Observer.Observe('stored_key_scaled', FormatStoredDecimal(Found.Dc))
else
Observer.Observe('stored_key_scaled', 'no row');
Observer.Expect('buffer_equal', 'Yes');
Observer.Expect('get_full', 'Yes');
Observer.Expect('get_cut', 'Yes');
Observer.Expect('stored_key_scaled', '277777777777777.77');
Comment on lines +881 to +882
Row.Amount := 0.000000000000000000019;
Observer.Observe('second_insert', Format(Row.Insert()));
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants